package com.project.fiveCerealsSavoury.domain;


import java.sql.Timestamp;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

public class Order {
	/**
	 * id
	 */
	private Integer id;
	/**
	 * 收获人姓名
	 */
	@NotBlank(message="收货人姓名不能为空")
	private String userName;
	/**
	 * 手机号
	 */
	@NotBlank(message="手机号不能为空")
	@Length(min=7,max=11,message="请输入电话最少7位，最大11位")
	private String userPhone;
	/**
	 * 商品名称
	 */
	@NotBlank(message="商品名称不能为空")
	private String goodName;
	/**
	 * 用户ID
	 */
	@NotBlank(message="用户ID不能为空")
	private Integer userId;
	/**
	 * 备注
	 */
	@NotBlank(message="备注不能为空")
	private String remark;
	/**
	 * 下单时间
	 */
	private Timestamp orderTime;
	/**
	 * 收货地址
	 */
	@NotBlank(message="收货地址不能为空")
	private String endAddress;
	/**
	 * 订单编号
	 */
	private String orderNumber;
	/**
	 * 订单状态
	 */
	private OrderState orderState;
	/**
	 * 商品数量
	 */
	@NotBlank(message="商品数量不能为空")
	private Integer goodNumber;
	/**
	 * 商品单价
	 */
	private double goodPrice;
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getUserPhone() {
		return userPhone;
	}
	public void setUserPhone(String userPhone) {
		this.userPhone = userPhone;
	}
	public String getGoodName() {
		return goodName;
	}
	public void setGoodName(String goodName) {
		this.goodName = goodName;
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Timestamp getOrderTime() {
		return orderTime;
	}
	public void setOrderTime(Timestamp orderTime) {
		this.orderTime = orderTime;
	}
	public String getEndAddress() {
		return endAddress;
	}
	public void setEndAddress(String endAddress) {
		this.endAddress = endAddress;
	}
	public String getOrderNumber() {
		return orderNumber;
	}
	public void setOrderNumber(String orderNumber) {
		this.orderNumber = orderNumber;
	}
	public OrderState getOrderState() {
		return orderState;
	}
	public void setOrderState(OrderState orderState) {
		this.orderState = orderState;
	}
	public Integer getGoodNumber() {
		return goodNumber;
	}
	public void setGoodNumber(Integer goodNumber) {
		this.goodNumber = goodNumber;
	}
	public double getGoodPrice() {
		return goodPrice;
	}
	public void setGoodPrice(double goodPrice) {
		this.goodPrice = goodPrice;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((endAddress == null) ? 0 : endAddress.hashCode());
		result = prime * result + ((goodName == null) ? 0 : goodName.hashCode());
		result = prime * result + ((goodNumber == null) ? 0 : goodNumber.hashCode());
		long temp;
		temp = Double.doubleToLongBits(goodPrice);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((orderNumber == null) ? 0 : orderNumber.hashCode());
		result = prime * result + ((orderState == null) ? 0 : orderState.hashCode());
		result = prime * result + ((orderTime == null) ? 0 : orderTime.hashCode());
		result = prime * result + ((remark == null) ? 0 : remark.hashCode());
		result = prime * result + ((userId == null) ? 0 : userId.hashCode());
		result = prime * result + ((userName == null) ? 0 : userName.hashCode());
		result = prime * result + ((userPhone == null) ? 0 : userPhone.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Order other = (Order) obj;
		if (endAddress == null) {
			if (other.endAddress != null)
				return false;
		} else if (!endAddress.equals(other.endAddress))
			return false;
		if (goodName == null) {
			if (other.goodName != null)
				return false;
		} else if (!goodName.equals(other.goodName))
			return false;
		if (goodNumber == null) {
			if (other.goodNumber != null)
				return false;
		} else if (!goodNumber.equals(other.goodNumber))
			return false;
		if (Double.doubleToLongBits(goodPrice) != Double.doubleToLongBits(other.goodPrice))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (orderNumber == null) {
			if (other.orderNumber != null)
				return false;
		} else if (!orderNumber.equals(other.orderNumber))
			return false;
		if (orderState != other.orderState)
			return false;
		if (orderTime == null) {
			if (other.orderTime != null)
				return false;
		} else if (!orderTime.equals(other.orderTime))
			return false;
		if (remark == null) {
			if (other.remark != null)
				return false;
		} else if (!remark.equals(other.remark))
			return false;
		if (userId == null) {
			if (other.userId != null)
				return false;
		} else if (!userId.equals(other.userId))
			return false;
		if (userName == null) {
			if (other.userName != null)
				return false;
		} else if (!userName.equals(other.userName))
			return false;
		if (userPhone == null) {
			if (other.userPhone != null)
				return false;
		} else if (!userPhone.equals(other.userPhone))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Order [id=" + id + ", userName=" + userName + ", userPhone=" + userPhone + ", goodName=" + goodName
				+ ", userId=" + userId + ", remark=" + remark + ", orderTime=" + orderTime + ", endAddress="
				+ endAddress + ", orderNumber=" + orderNumber + ", orderState="
				+ orderState + ", goodNumber=" + goodNumber + ", goodPrice=" + goodPrice + "]";
	}
	public Order() {
		super();
		// TODO Auto-generated constructor stub
	}
}
